
import { _decorator, Component, Node } from 'cc';
import { UIComponent } from '../../Script/Common/UIComponent';
import yyComponent from '../../Script/Common/yyComponent';
import { GlobalEnum } from '../../Script/GameSpecial/GlobalEnum';
import PlayerData from '../../Script/Common/PlayerData';
import EventManager from '../../Script/Common/EventManager';
import { EventType } from '../../Script/GameSpecial/GameEventType';
const { ccclass, property } = _decorator;

@ccclass('SpinUI')
export class SpinUI extends UIComponent {
    uiType: GlobalEnum.UI = GlobalEnum.UI.spin;

    onLoad() {
        let data = PlayerData.getPlayerData().spinData;
        let t = data.lastTime;
        let date = new Date(t);
        if (date.getDate() != new Date().getDate()) {
            data.count = 0;
            data.lastTime = Date.now();
        }
    }
    
    protected onBtnNative() {
        EventManager.emit(EventType.Common.HeyGameSDK.clickNativeAd);
    }
}
